Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated network interfaces on ESXi provider #1183

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

jonner
Copy link
Contributor

@jonner jonner commented Nov 13, 2024

Bug MTV-1291 describes an issue where, on ESXi providers, opening the modal dialog for changing the migration network for a host may display a list with multiple copies of the same network listed as options. This same issue was not observed with the vCenter endpoint type for the same provider.

I managed to reproduce this behavior by simply starting a vm on the host. After the VM boots up, the ESXi provider will emit an ObjectUpdate for the host object which contains ChangeSets that assign new values to the list of PNICs, VNICs, portgroups, and vswitches for that host. It doesn't appear that these values have changed, so it's unclear why we're getting change notifications for them. But, the end result is that every time a vm is started, a duplicate list of networks is being appended to the current list of networks for the host. So when I started a VM 5 times on the host, the list of networks ended up with 5 duplicates of each network interface.

When getting object updates from the ESXi server, object values that are array types (such as vswitch, portgroup, pnic, vnic), were being appended to our current list of values for those properties. But since the object update contains the entire list of values for those properties, this ended up adding duplicate values to our list. The solution to the issue is to replace our current array of networks with the values that we receive from the object update event rather than appending them to our current array.

As far as I can tell, the vCenter provider doesn't seem to trigger the host object update event when a vm starts, which is why the same behavior was not seen for this provider type. But it seems that it would also be susceptible to the same bug if the update did ever occur.

Fixes: https://issues.redhat.com/browse/MTV-1291

Bug MTV-1291 describes an issue where, on ESXi providers, opening the
modal dialog for changing the migration network for a host may display
a list with multiple copies of the same network listed as options. This
same issue was not observed with the vCenter endpoint type for the same
provider.

I managed to reproduce this behavior by simply starting a vm on the host.
After the VM boots up, the ESXi provider will emit an ObjectUpdate for
the host object which contains ChangeSets that assign new values to
the list of PNICs, VNICs, portgroups, and vswitches for that host. It
doesn't appear that these values have changed, so it's unclear why we're
getting change notifications for them. But, the end result is that every
time a vm is started, a duplicate list of networks is being appended
to the current list of networks for the host. So when I started a VM 5
times on the host, the list of networks ended up with 5 duplicates of
each network interface.

When getting object updates from the ESXi server, object values that
are array types (such as vswitch, portgroup, pnic, vnic), were being
appended to our current list of values for those properties. But
since the object update contains the entire list of values for those
properties, this ended up adding duplicate values to our list. The
solution to the issue is to *replace* our current array of networks
with the values that we receive from the object update event rather than
appending them to our current array.

As far as I can tell, the vCenter provider doesn't seem to trigger
the host object update event when a vm starts, which is why the same
behavior was not seen for this provider type. But it seems that it
would also be susceptible to the same bug if the update did ever occur.

Fixes: https://issues.redhat.com/browse/MTV-1291

Signed-off-by: Jonathon Jongsma <[email protected]>
@jonner jonner requested review from mnecas and yaacov as code owners November 13, 2024 17:22
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 15.66%. Comparing base (d22c8b3) to head (72b39b2).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/provider/container/vsphere/model.go 0.00% 4 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1183      +/-   ##
==========================================
- Coverage   15.66%   15.66%   -0.01%     
==========================================
  Files         112      112              
  Lines       23052    23056       +4     
==========================================
  Hits         3612     3612              
- Misses      19155    19159       +4     
  Partials      285      285              
Flag Coverage Δ
unittests 15.66% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yaacov yaacov merged commit 6e27724 into kubev2v:main Nov 27, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants